/**
 * 依赖注入相关类型定义
 */

/**
 * 服务令牌类型
 */
export type ServiceToken = string | symbol;

/**
 * 工厂函数类型
 */
export type ServiceFactory<T> = (container: any) => T;

/**
 * 服务构造器类型
 */
export type ServiceConstructor<T = any> = new (...args: any[]) => T;

/**
 * 服务生命周期类型
 */
export type ServiceLifecycle = 'singleton' | 'transient' | 'scoped';

/**
 * 装饰器元数据键
 */
export const METADATA_KEYS = {
    INJECTABLE: Symbol('injectable'),
    INJECT: Symbol('inject'),
    DEPENDENCIES: Symbol('dependencies')
} as const;

/**
 * 注入装饰器参数
 */
export interface InjectableOptions {
    lifecycle?: ServiceLifecycle;
    token?: ServiceToken;
}

/**
 * 依赖项描述
 */
export interface DependencyDescriptor {
    token: ServiceToken;
    optional?: boolean;
    index: number;
}

/**
 * 服务描述符
 */
export interface ServiceDescriptor {
    token: ServiceToken;
    factory?: ServiceFactory<any>;
    constructor?: ServiceConstructor;
    lifecycle: ServiceLifecycle;
    dependencies: DependencyDescriptor[];
}

/**
 * 容器配置选项
 */
export interface ContainerOptions {
    enableAutoRegistration?: boolean;
    enableCircularDependencyDetection?: boolean;
    maxResolutionDepth?: number;
}

/**
 * 解析上下文
 */
export interface ResolutionContext {
    container: any;
    currentToken: ServiceToken;
    stack: ServiceToken[];
    scope?: any;
}
